package com.csust.zerocode.config.chatmodel;

import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@ConfigurationProperties(prefix = "langchain4j.open-ai.reasoning-streaming-chat-model")
@Data
public class ReasoningStreamingChatModelConfig {

    private String baseUrl;

    private String apiKey;

    private String modelName;

    private Integer maxTokens;

    private Double temperature;

    private Boolean returnThinking;

    private Boolean logRequests = false;

    private Boolean logResponses = false;

    /**
     * 推理流式模型（用于 Vue 项目生成，带工具调用）
     */
    @Bean
    public StreamingChatModel reasoningStreamingChatModelPrototype() {
        // 为了测试方便临时修改
//        final String modelName = "qwen3-coder-plus-2025-07-22";
//        final int maxTokens = 8192;
        // 生产环境使用：
//        final String modelName = "deepseek-r1";
        // final int maxTokens = 32768;
        /**
         * 智谱ai
         */
        final String baseUrlBigModel = "https://open.bigmodel.cn/api/paas/v4/";
        final String bigModel = "glm-4.5";
        final String apiKeyBigModel =  "940bb93b6d4540129ee07cbc73e3faea.U8o9vmAgUXOFh5k9";
        return OpenAiStreamingChatModel.builder()
                .apiKey(apiKey)
                .baseUrl(baseUrl)
                .modelName(modelName)
                .maxTokens(maxTokens)
                .returnThinking(returnThinking)
                .logRequests(logRequests)
                .logResponses(logResponses)
                .build();
    }
}
